import { createRouter, createWebHashHistory } from 'vue-router'

const routes = [
  {
    path: '/login',
    name: 'login',
    component: () => import('../views/LoginView')
  },
  {
    path: '/',
    name: '/',
    component: () => import('../layout'),
    redirect: '/user',
    children: [
      {
        path: 'user',
        name: 'user',
        component: () => import('@/views/User')
      },
      {
        path: 'admin',
        name: 'admin',
        component: () => import('@/views/Admin')
      },
      {
        path: 'question',
        name: 'question',
        component: () => import('@/views/Question')
      },
      {
        path: 'addquestion',
        name: 'addquestion',
        component: () => import('@/views/AddQuestion')
      },
      {
        path: 'comment',
        name: 'comment',
        component: () => import('@/views/Comment')
      },
      {
        path: 'exam',
        name: 'exam',
        component: () => import('@/views/Exam')
      }
    ]
  }
]

const router = createRouter({
  history: createWebHashHistory(),
  routes
})

export default router
